import { Goods, goodSymid } from "./demo3";

type testType = {
  name: string;
  // [x:number]:any
  [x: string]: any; //! 可以表示[x:string] [x:number]
};

// [x:number] 101 "101"都可以表示
let testobj: testType = {
  name: "wangsu",
  101: "www1",
  "111": "222",
  // '11we':1// 报错
};

type Record<T> = {
  [p in keyof any]: T;
};
// ===>结果
// type Record<T> = {
//   [x: string]: T;
// }

type resultGoodstype = Record<Goods>;

let goodRecord: resultGoodstype = {};

let good: Goods = { [goodSymid]: 101, name: "pingguop", price: 9 };

goodRecord[103] = good;
goodRecord["香蕉"] = good;

console.log('goodRecord',goodRecord);

export {};
